package com.shuw.com.beingfortextproject.activity;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.example.library.AutoFlowLayout;
import com.example.library.FlowAdapter;
import com.shuw.com.beingfortextproject.R;
import com.shuw.com.beingfortextproject.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AutoFlowActivity extends BaseActivity {

	@BindView(R.id.center_title)
	TextView centerTitle;
	@BindView(R.id.toolbar)
	Toolbar toolbar;
	@BindView(R.id.autoFlowLayout)
	AutoFlowLayout autoFlowLayout;

	private LayoutInflater mLayoutInflater;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_auto_flow);

		ButterKnife.bind(this);
		initView();
		initData();
	}

	private void initData() {
		
	}

	private void initView() {
		mLayoutInflater = LayoutInflater.from(mContext);
		centerTitle.setText("标签页测试");
		setToolbar(toolbar);
		List<String> mData = new ArrayList<>();
		mData.add("标签一");
		mData.add("标签标签标签");
		mData.add("标签二");
		mData.add("标签一三四五");
		mData.add("标签一其八九");
		mData.add("你说呢");
		mData.add("加条件啊");
		mData.add("房租变了好多呢");
		autoFlowLayout.setAdapter(new FlowAdapter(mData) {
			@Override
			public View getView(int i) {
				View item = mLayoutInflater.inflate(R.layout.item_auto_flow_layout,null);
				TextView tv = item.findViewById(R.id.contentTv);
				tv.setText(mData.get(i));
				return item;
			}
		});
	}

	@OnClick({R.id.autoFlowLayout})
	public void onClick(View view) {
		switch (view.getId()) {

			case R.id.autoFlowLayout:
				break;
		}
	}
}
